﻿@using MrCMS.Helpers
@model MrCMS.Messages.MessageTemplate
@{
    ViewBag.Title = "Edit Message Template";
    Html.IncludeScript("~/Areas/Admin/Content/Scripts/mrcms/message-template.js");
}

@using (Html.BeginForm("Edit", "MessageTemplate", new { TemplateType = Model.GetType().FullName }, FormMethod.Post, new { id = "edit-message-template" }))
{
    <fieldset>
        <legend>
            @Resource("Edit") @Model.GetType().Name.BreakUpString() (@(Model.SiteId.HasValue ? "Site Override" : "System default"))
            <span class="pull-right btn-group  display-inline ">
                @Html.ActionLink(Resource("Back"), "Index", "MessageTemplate", null, new { @class = "btn btn-default" })
                <input class="btn btn-primary" type="submit" value="@Resource("Save")" />
            </span>
        </legend>
        @Html.HiddenFor(x => x.SiteId)
        <div class="row">
            <div class="col-lg-6">
                <div class="form-group">
                    @Html.LabelFor(x => x.FromAddress)
                    @Html.TextBoxFor(x => x.FromAddress, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.FromAddress)
                </div>
                <div class="form-group">
                    @Html.LabelFor(x => x.FromName)
                    @Html.TextBoxFor(x => x.FromName, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.FromName)
                </div>
                <div class="form-group">
                    @Html.LabelFor(x => x.Cc)
                    @Html.TextBoxFor(x => x.Cc, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.Cc)
                </div>
            </div>
            <div class="col-lg-6">
                <div class="form-group">
                    @Html.LabelFor(x => x.ToAddress)
                    @Html.TextBoxFor(x => x.ToAddress, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.ToAddress)
                </div>
                <div class="form-group">
                    @Html.LabelFor(x => x.ToName)
                    @Html.TextBoxFor(x => x.ToName, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.ToName)
                </div>
                <div class="form-group">
                    @Html.LabelFor(x => x.Bcc)
                    @Html.TextBoxFor(x => x.Bcc, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.Bcc)
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                @Html.InfoBlock(Resource("Heads up" + "!"), "To send to multiple email addresses via To, Cc or Bcc, separate them with a comma, not a semi-colon")
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="form-group">
                    @Html.LabelFor(x => x.Subject)
                    @Html.TextBoxFor(x => x.Subject, new { @class = "form-control" })
                    @Html.ValidationMessageFor(x => x.Subject)
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="form-group">
                    @Html.LabelFor(x => x.Body)
                    @Html.TextAreaFor(x => x.Body, new { @class = (Model.IsHtml ? "message-ckedit form-control" : "form-control"), style = "min-height:200px;" })
                    @Html.ValidationMessageFor(x => x.Body)
                </div>
            </div>
        </div>
        @Html.InlineCheckboxFor(x => x.IsHtml)
        @Html.InlineCheckboxFor(x => x.IsDisabled)

        @{ Html.RenderAction("Tokens", "MessageTemplateTokens", new { messageTemplate = Model });}
    </fieldset>
}